package com.ruoyi.match.enums;

import com.ruoyi.match.dto.OddsDto;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.math.BigDecimal;

/**
 * @author sjz
 * @version 1.0.0
 * @desc
 * @date 2023/11/5 17:09
 **/
@Getter
@AllArgsConstructor
public enum OddsRange {
    RANG_1(1,"0","0.25"),
    RANG_2(2,"0.25","0.5"),
    RANG_3(3,"0.5","0.75"),
    RANG_4(4,"0.75","1"),
    RANG_5(5,"1","1.25"),
    RANG_6(6,"1.25","1.5"),
    RANG_7(7,"1.5","1.75"),
    RANG_8(8,"1.75","2"),
    RANG_9(9,"2","2.25"),
    RANG_10(10,"2.25","2.5"),
    RANG_11(11,"2.5","2.75"),
    RANG_12(12,"2.75","3"),
    RANG_13(13,"3","3.25"),
    RANG_14(14,"3.25","3.5"),
    RANG_15(15,"3.5","3.75"),
    RANG_16(16,"3.75","4"),
    RANG_17(17,"4","4.25"),
    RANG_18(18,"4.25","4.5"),
    RANG_19(19,"4.5","4.75"),
    RANG_20(20,"4.75","5"),
    RANG_21(21,"5","5.25"),
    RANG_22(22,"5.25","5.5"),
    RANG_23(23,"5.5","5.75"),
    RANG_24(24,"5.75","6"),
    RANG_25(25,"6","6.25"),
    RANG_26(26,"6.25","6.5"),
    RANG_27(27,"6.5","6.75"),
    RANG_28(28,"6.75","7"),
    RANG_29(29,"7","7.25"),
    RANG_30(30,"7.25","7.5"),
    RANG_31(31,"7.5","7.75"),
    RANG_32(32,"7.75","8"),
    RANG_33(33,"8","8.25"),
    RANG_34(34,"8.25","8.5"),
    RANG_35(35,"8.5","8.75"),
    RANG_36(36,"8.75","9"),
    RANG_37(37,"9","9.25"),
    RANG_38(38,"9.25","9.5"),
    RANG_39(39,"9.5","9.75"),
    RANG_40(40,"9.75","10"),
    RANG_41(41,"10","10.25"),
    RANG_42(42,"10.25","10.5"),
    RANG_43(43,"10.5","10.75"),
    RANG_44(44,"10.75","11"),
    RANG_45(45,"11","11.25"),
    RANG_46(46,"11.25","11.5"),
    RANG_47(47,"11.5","11.75"),
    RANG_48(48,"11.75","12"),
    RANG_49(49,"12","12.25"),
    RANG_50(50,"12.25","12.5"),
    RANG_51(51,"12.5","12.75"),
    RANG_52(52,"12.75","13"),
    RANG_53(53,"13","13.25"),
    RANG_54(54,"13.25","13.5"),
    RANG_55(55,"13.5","13.75"),
    RANG_56(56,"13.75","14"),
    RANG_57(57,"14","14.25"),
    RANG_58(58,"14.25","14.5"),
    RANG_59(59,"14.5","14.75"),
    RANG_60(60,"14.75","15"),
    RANG_61(61,"15","15.25"),
    RANG_62(62,"15.25","15.5"),
    RANG_63(63,"15.5","15.75"),
    RANG_64(64,"15.75","16"),
    RANG_65(65,"16","16.25"),
    RANG_66(66,"16.25","16.5"),
    RANG_67(67,"16.5","16.75"),
    RANG_68(68,"16.75","17"),
    RANG_69(69,"17","17.25"),
    RANG_70(70,"17.25","17.5"),
    RANG_71(71,"17.5","17.75"),
    RANG_72(72,"17.75","18"),
    RANG_73(73,"18","18.25"),
    RANG_74(74,"18.25","18.5"),
    RANG_75(75,"18.5","18.75"),
    RANG_76(76,"18.75","19"),
    RANG_77(77,"19","19.25"),
    RANG_78(78,"19.25","19.5"),
    RANG_79(79,"19.5","19.75"),
    RANG_80(80,"19.75","20"),
    RANG_81(81,"20","20.25"),
    RANG_82(82,"20.25","20.5"),
    RANG_83(83,"20.5","20.75"),
    RANG_84(84,"20.75","21"),
    RANG_85(85,"21","21.25"),
    RANG_86(86,"21.25","21.5"),
    RANG_87(87,"21.5","21.75"),
    RANG_88(88,"21.75","22"),
    RANG_89(89,"22","22.25"),
    RANG_90(90,"22.25","22.5"),
    RANG_91(91,"22.5","22.75"),
    RANG_92(92,"22.75","23"),
    RANG_93(93,"23","23.25"),
    RANG_94(94,"23.25","23.5"),
    RANG_95(95,"23.5","23.75"),
    RANG_96(96,"23.75","24"),
    RANG_97(97,"24","24.25"),
    RANG_98(98,"24.25","24.5"),
    RANG_99(99,"24.5","24.75"),
    RANG_100(100,"24.75","25"),
    RANG_101(101,"25","25.25"),
    RANG_102(102,"25.25","25.5"),
    RANG_103(103,"25.5","25.75"),
    RANG_104(104,"25.75","26"),
    RANG_105(105,"26","26.25"),
    RANG_106(106,"26.25","26.5"),
    RANG_107(107,"26.5","26.75"),
    RANG_108(108,"26.75","27"),
    RANG_109(109,"27","27.25"),
    RANG_110(110,"27.25","27.5"),
    RANG_111(111,"27.5","27.75"),
    RANG_112(112,"27.75","28"),
    RANG_113(113,"28","28.25"),
    RANG_114(114,"28.25","28.5"),
    RANG_115(115,"28.5","28.75"),
    RANG_116(116,"28.75","29"),
    RANG_117(117,"29","29.25"),
    RANG_118(118,"29.25","29.5"),
    RANG_119(119,"29.5","29.75"),
    RANG_120(120,"29.75","30"),
    RANG_121(121,"30","30.25"),
    RANG_122(122,"30.25","30.5"),
    RANG_123(123,"30.5","30.75"),
    RANG_124(124,"30.75","31"),
    RANG_125(125,"31","31.25"),
    RANG_126(126,"31.25","31.5"),
    RANG_127(127,"31.5","31.75"),
    RANG_128(128,"31.75","32"),
    RANG_129(129,"32","1000"),
    ;
    private Integer rangeIndex;

    private String min;
    private String max;

    public static OddsDto getRangeIndex(BigDecimal v){
        for (OddsRange value : OddsRange.values()) {
            BigDecimal max = new BigDecimal(value.getMax());
            BigDecimal min = new BigDecimal(value.getMin());
            if((v.compareTo(min) > -1) && (v.compareTo(max) < 0)){
                OddsDto dto = new OddsDto();
                dto.setMin(min);
                dto.setMax(max);
                return dto;
            }
        }
        return null;
    }
}
